// 验证手机号格式
export function checkTel(tel) {
  return /^1\d{10}$/.test(tel)
}

export function getRanNum(){
  var str = '';
  for(var i=0;i<4;i++){
    str += String.fromCharCode(Math.floor(Math.random() * 26) + 'a'.charCodeAt(0))
  }
  return  str
}
export function getDate(time) {
	var timestr = new Date(parseInt(time) * 1000)
	var year = timestr.getFullYear();
	var month = addZero(timestr.getMonth()+1)
	var date = addZero(timestr.getDate())
	var hour = addZero(timestr.getHours())
	var minute = addZero(timestr.getMinutes())
	var second = addZero(timestr.getSeconds())
	return `${year}-${month}-${date} ${hour}:${minute}:${second}`
}

function addZero(t) {
	return t>9?t:'0'+t
}